<template>
    <div class="manage-permission manage_table_100-35">
        <div style="height: 35px">
            <el-form :model="searchForm" :inline="true" size="mini">
                <el-form-item label="name">
                    <el-input v-model="searchForm.name"></el-input>
                </el-form-item>
                <el-form-item label="code">
                    <el-input v-model="searchForm.code"></el-input>
                </el-form-item>
                <el-form-item>
                    <el-button type="primary" icon="el-icon-search"></el-button>
                    <el-button type="primary" icon="el-icon-refresh"></el-button>
                    <el-button type="primary" icon="el-icon-plus"></el-button>
                </el-form-item>
            </el-form>
        </div>
        <el-table
                border
                default-expand-all
                highlight-current-row
                :data="permissionTable"
                row-key="ukId"
                height="500"
                size="mini"
                style="width: 100%"
                :tree-props="{children: 'children', hasChildren: 'hasChildren'}">
            <el-table-column
                    prop="name"
                    label="name"
                    width="*">
            </el-table-column>
            <el-table-column
                    prop="code"
                    label="code"
                    width="150">
            </el-table-column>
            <el-table-column
                    prop="value"
                    label="value"
                    width="180">
            </el-table-column>
            <el-table-column
                    prop="url"
                    label="url"
                    width="200">
            </el-table-column>
            <el-table-column
                    show-overflow-tooltip
                    prop="summary"
                    label="summary"
                    width="120">
            </el-table-column>
            <el-table-column
                    prop="status"
                    label="status"
                    width="70">
                <template slot-scope="scope">
                    <el-switch
                            :value="scope.row.status != '1'"
                            active-color="#909399"
                            inactive-color="#67c23a">
                    </el-switch>
                </template>
            </el-table-column>
            <el-table-column
                    prop="sort"
                    label="sort"
                    width="60">
            </el-table-column>
            <el-table-column
                    label="操作"
                    width="145">
                <template slot-scope="scope">
                    <el-button type="primary" icon="el-icon-edit" size="mini"></el-button>
                    <el-button type="danger" icon="el-icon-delete" size="mini"></el-button>
                </template>
            </el-table-column>
        </el-table>
        <el-dialog title="权限管理" :visible.sync="showPermissionForm" :close-on-click-modal="false" label-width="80px">
            <el-form ref="form" :model="permissionForm" label-width="80px">
                <el-form-item label="权限编码">
                    <el-input v-model="permissionForm.code"></el-input>
                </el-form-item>
                <el-form-item label="权限名称">
                    <el-input v-model="permissionForm.name"></el-input>
                </el-form-item>
                <el-form-item label="权限值">
                    <el-input v-model="permissionForm.value"></el-input>
                </el-form-item>
                <el-form-item label="请求地址">
                    <el-input v-model="permissionForm.url"></el-input>
                </el-form-item>
                <el-form-item label="权限简介">
                    <el-input v-model="permissionForm.summary"></el-input>
                </el-form-item>
                <el-form-item label="状态">
                    <el-select v-model="permissionForm.status" placeholder="请选择状态">
                        <el-option
                                v-for="item in dictItems"
                                :key="item.ukId"
                                :label="item.name"
                                :value="parseInt(item.value)">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="排序">
                    <el-input v-model="permissionForm.sort" type="number" min="0" max="90000"></el-input>
                </el-form-item>
                <el-form-item>
                    <el-button type="primary">保存</el-button>
                    <el-button @click="showPermissionForm = false">取 消</el-button>
                </el-form-item>
            </el-form>
        </el-dialog>
    </div>
</template>

<script>
    export default {
        name: "Permission",
        data () {
            return {
                showPermissionForm: false,
                permissionTable: [
                    {
                        name: "新建用户",
                        code: "新建用户",
                        value: "新建用户",
                        url: "新建用户",
                        summary: "新建用户",
                        status: '1',
                        sort: 1000
                    },
                    {
                        name: "新建用户",
                        code: "新建用户",
                        value: "新建用户",
                        url: "新建用户",
                        summary: "新建用户",
                        status: '1',
                        sort: 1000
                    },
                    {
                        name: "新建用户",
                        code: "新建用户",
                        value: "新建用户",
                        url: "新建用户",
                        summary: "新建用户",
                        status: '1',
                        sort: 1000
                    },
                    {
                        name: "新建用户",
                        code: "新建用户",
                        value: "新建用户",
                        url: "新建用户",
                        summary: "新建用户",
                        status: '1',
                        sort: 1000
                    },
                    {
                        name: "新建用户",
                        code: "新建用户",
                        value: "新建用户",
                        url: "新建用户",
                        summary: "新建用户",
                        status: '1',
                        sort: 1000
                    },
                    {
                        name: "新建用户",
                        code: "新建用户",
                        value: "新建用户",
                        url: "新建用户",
                        summary: "新建用户",
                        status: '1',
                        sort: 1000
                    },
                    {
                        name: "新建用户",
                        code: "新建用户",
                        value: "新建用户",
                        url: "新建用户",
                        summary: "新建用户",
                        status: '1',
                        sort: 1000
                    },
                    {
                        name: "新建用户",
                        code: "新建用户",
                        value: "新建用户",
                        url: "新建用户",
                        summary: "新建用户",
                        status: '1',
                        sort: 1000
                    },
                    {
                        name: "新建用户",
                        code: "新建用户",
                        value: "新建用户",
                        url: "新建用户",
                        summary: "新建用户",
                        status: '1',
                        sort: 1000
                    },
                    {
                        name: "新建用户",
                        code: "新建用户",
                        value: "新建用户",
                        url: "新建用户",
                        summary: "新建用户",
                        status: '1',
                        sort: 1000
                    },
                    {
                        name: "新建用户",
                        code: "新建用户",
                        value: "新建用户",
                        url: "新建用户",
                        summary: "新建用户",
                        status: '1',
                        sort: 1000
                    },
                    {
                        name: "新建用户",
                        code: "新建用户",
                        value: "新建用户",
                        url: "新建用户",
                        summary: "新建用户",
                        status: '1',
                        sort: 1000
                    },
                    {
                        name: "新建用户",
                        code: "新建用户",
                        value: "新建用户",
                        url: "新建用户",
                        summary: "新建用户",
                        status: '1',
                        sort: 1000
                    },
                    {
                        name: "新建用户",
                        code: "新建用户",
                        value: "新建用户",
                        url: "新建用户",
                        summary: "新建用户",
                        status: '1',
                        sort: 1000
                    },
                    {
                        name: "新建用户",
                        code: "新建用户",
                        value: "新建用户",
                        url: "新建用户",
                        summary: "新建用户",
                        status: '1',
                        sort: 1000
                    },
                    {
                        name: "新建用户",
                        code: "新建用户",
                        value: "新建用户",
                        url: "新建用户",
                        summary: "新建用户",
                        status: '1',
                        sort: 1000
                    },
                    {
                        name: "新建用户11111111",
                        code: "新建用户",
                        value: "新建用户",
                        url: "新建用户",
                        summary: "新建用户",
                        status: '1',
                        sort: 1000
                    },
                ],
                searchForm: {},
                permissionForm: {},
                pagination: {
                    total: 0,
                    size: 30,
                    current: 1,
                },
                dictItems: []
            }
        },
    }
</script>

<style scoped>
    .manage-permission {
        width: 100%;
        height: 100%;
    }
</style>